<?php

/*
 * litchicms
 * Copyright (C) 2010-6-13 Author: tiefa(539247@qq.com)
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
!defined('BRK') && exit("!");

/*
 * input_control
 */

function input_control($name, $value='', $id="", $type="text", $classname="input_text", $width=FALSE, $disabled=FALSE) {
    if (empty($name)) {
        exit("input_control");
    }
    return "<input type=\"$type\"  " . ($disabled ? 'disabled' : '') . "  name=\"field[$name]\" value=\"$value\" id=\"$id\" class=\"$classname\" " . ($width ? "style='width:" . $width . "px'" : '') . "/>";
}

/*
 * input_text_control
 */

function input_text_control($name, $value='', $id="", $type="text", $classname="input_text", $width=FALSE, $disabled=FALSE) {
    return input_control($name, $value, $id, $type, $classname, $width, $disabled);
}

/*
 * input_text_control
 */

function input_hidden_control($name, $value='', $id='', $type="hidden") {
    return "<input type=\"$type\" name=\"field[$name]\" value=\"$value\" id=\"$id\" />";
}

/*
 * input_rich_control
 */

function input_rich_control($name, $value='', $id='', $classname="input_text", $width=FALSE, $height=FALSE) {
    return "
    <textarea name=\"field[$name]\" class='ceditor' id=\"$id\" >$value</textarea>
    <script language='javascript' type='text/javascript' src='system/utils/tiny_mce/tiny_mce.js' charset='utf-8'></script>
    <script language='javascript' type='text/javascript' src='system/data/mce/mceconf.js'></script>
    ";
}

/*
 * input_select_control
 */

function input_select_control($name, $value='', $id='', $classname="input_text") {
    return "
    <textarea name=\"field[$name]\" class=\"ceditor\" id=\"$id\" >$value</textarea>
    <script language='javascript' type='text/javascript' src='system/utils/tiny_mce/tiny_mce.js' charset='utf-8'></script>
    <script language='javascript' type='text/javascript' src='system/data/mce/mceconf.js'></script>
    ";
}
